package org.linlinjava.litemall.admin.web;

import com.alibaba.druid.util.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
import org.linlinjava.litemall.core.util.ResponseUtil;
import org.linlinjava.litemall.core.validator.Order;
import org.linlinjava.litemall.core.validator.Sort;
import org.linlinjava.litemall.db.domain.CuCustomer;
import org.linlinjava.litemall.db.domain.LitemallShop;
import org.linlinjava.litemall.db.service.CuCustomerService;
import org.linlinjava.litemall.db.service.LitemallShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
import java.util.List;


@RestController
@RequestMapping("/admin/user")
@Validated
public class CuCustomerController {
    @Autowired
    private CuCustomerService customerService;

    @RequiresPermissions("admin:user:list1")
    @RequiresPermissionsDesc(menu = {"商场管理", "店铺列表"}, button = "查询")
    @GetMapping("/list1")
    public Object list(String customerName, String customerPhone,
                       @RequestParam(defaultValue = "1") Integer page,
                       @RequestParam(defaultValue = "10") Integer limit,
                       @Sort @RequestParam(defaultValue = "create_time") String sort,
                       @Order @RequestParam(defaultValue = "desc") String order) {
        List<CuCustomer> brandList = customerService.querySelective(customerName, customerPhone, page, limit, sort, order);
        return ResponseUtil.okList(brandList);
    }
}
